import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EquipmentTypeVO, EquipmentTypeForm, EquipmentTypeQuery } from '@/api/facility/equipment-type/types';

/**
 * 查询设备类型列表
 * @param query
 * @returns {*}
 */

export const listEquipmentType = (query?: EquipmentTypeQuery): AxiosPromise<EquipmentTypeVO[]> => {
  return request({
    url: '/equipment/equipment-type/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备类型详细
 * @param equipmentTypeId
 */
export const getEquipmentType = (equipmentTypeId: string | number): AxiosPromise<EquipmentTypeVO> => {
  return request({
    url: '/equipment/equipment-type/' + equipmentTypeId,
    method: 'get'
  });
};

/**
 * 新增设备类型
 * @param data
 */
export const addEquipmentType = (data: EquipmentTypeForm) => {
  return request({
    url: '/equipment/equipment-type',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备类型
 * @param data
 */
export const updateEquipmentType = (data: EquipmentTypeForm) => {
  return request({
    url: '/equipment/equipment-type',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备类型
 * @param equipmentTypeId
 */
export const delEquipmentType = (equipmentTypeId: string | number | Array<string | number>) => {
  return request({
    url: '/equipment/equipment-type/' + equipmentTypeId,
    method: 'delete'
  });
};
